import { _decorator, Component, Label, Node } from 'cc';
import { User } from '../../../ISUtility/Script/User';
const { ccclass, property } = _decorator;

@ccclass('UICom_MoneyTItel')
export class UICom_MoneyTItel extends Component {

    @property({type : Label})
    public TextLabel : Label = null;

    private _last : number = 0;

    start() {
        this.updateMoney(false);
    }

    update(deltaTime: number) {
        this.updateMoney();
    }

    protected  updateMoney(check : boolean = true) : void {
        if(!check || this._last != User.inst.Data.money){
            this._last = User.inst.Data.money;
            this.TextLabel.string = this._last.toString();
        }
    }
}


